# coding: utf8
# datetime: 2021-03-26
# 题目地址: https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/


# Definition for singly-linked list.
class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next


class Solution:
    def deleteDuplicates(self, head: ListNode) -> ListNode:
        ret_list = ListNode(0, head)
        tmp = ret_list

        while tmp.next and tmp.next.next:
            if tmp.next.val == tmp.next.next.val:
                tmp.next = tmp.next.next
            else:
                tmp = tmp.next

        return ret_list.next